package com.ztesoft.web.baseconfig.service;

import java.util.List;

import com.ztesoft.core.common.Page;
import com.ztesoft.framework.exception.BaseAppException;
import com.ztesoft.web.baseconfig.db.po.DmPlanPO;
import com.ztesoft.web.baseconfig.db.po.DmPlanRelationPO;

/**
 * <Description> <br>
 * 
 * @author lin.jie<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2015年8月4日 <br>
 * @since V1.0<br>
 * @see com.ztesoft.web.baseconfig.service <br>
 */

public interface IDmPlanRelationService {

	/**
	 * 获取指定表的已经失效的计划
	 * 
	 * @param sourceDataId
	 * @return
	 * @throws BaseAppException
	 */
	DmPlanRelationPO selectBySourceDataId(Integer sourceDataId) throws BaseAppException;

	DmPlanRelationPO selectByPrimaryKey(DmPlanRelationPO record) throws BaseAppException;

	List<DmPlanRelationPO> selectByArg(DmPlanRelationPO record) throws BaseAppException;

	Page<DmPlanRelationPO> selectByArgAndPage(DmPlanRelationPO record, Page<DmPlanRelationPO> resultPage)
			throws BaseAppException;

	int addForDraft(DmPlanRelationPO record) throws BaseAppException;

	DmPlanRelationPO add(DmPlanRelationPO record) throws BaseAppException;

	int update(DmPlanRelationPO record) throws BaseAppException;

	int delete(DmPlanRelationPO record) throws BaseAppException;

	/**
	 * 获取该计划下，策略的下一个顺序
	 * 
	 * @param id
	 * @return
	 * @throws BaseAppException
	 */
	int getStrategyNextExecOrder(Integer id) throws BaseAppException;

	/**
	 * 查询策略 ，根据计划标识和组号获取有效策略，循环策略创建任务环节记录
	 * 
	 * @param dmPlanId
	 * @param groupNbr
	 * @return
	 * @throws BaseAppException
	 */
	List<DmPlanRelationPO> selectByPlanIdAndGroupNbr(Integer dmPlanId, Integer groupNbr) throws BaseAppException;

	List<DmPlanRelationPO> selectByDmPlanId(Integer dmPlanId) throws BaseAppException;

}
